﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace ThienNamElevator
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void Login_Load(object sender, EventArgs e)
        {
            
        }
        private bool CompareStrings(string string1, string string2)  
	    {  
	            return String.Compare(string1, string2, true, System.Globalization.CultureInfo.InvariantCulture) == 0 ? true : false;  
	    }  

        private void btnLogin_Click(object sender, EventArgs e)
        {
            dangnhapTableAdapters.QueriesTableAdapter q = new dangnhapTableAdapters.QueriesTableAdapter();
            if (q.checkLog(txtUsername.Text, txtPassword.Text) == 1)
            {
                Form1 frm = new Form1();
                frm.Show();
                this.Hide();
                //MessageBox.Show("Succesfull", "Thông báo!", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Thông tin đăng nhập lỗi!", "Thông báo", MessageBoxButtons.OK);
            }
        }

        private void txtPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnLogin.PerformClick();
            }
        }
    }
}
